#include <iostream>
#include <limits>
#include <cstring>
using std::cout;
using std::endl;
using std::cin;
using std::string;

void check_stream_status(){
    cout << "cin goodbit:" << cin.good() << endl;
    cout << "cin badbit:" << cin.bad() << endl;
    cout << "cin failbit:" << cin.fail() << endl;
    cout << "cin eofbit:" << cin.eof() << endl;

}

void test(){
    while(1){

    check_stream_status();
    int num;
    cout << "输入" << endl;
    cin >> num;
    if(!cin.good()){
        //check_stream_status();
        cout<<"EORROR"<<endl;
        cin.clear();
        cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
        continue;
    }
    cout << num << endl;

    }
}

int main()
{
    test();
    return 0;
}

